<%@ page contentType="text/html;charset=UTF-8" language="java"  pageEncoding="UTF-8"%>  
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <link rel="icon" href="/asset/bootstrap/favicon.ico">
    <title>用户列表页</title>
    <link href="/asset/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <link href="/asset/bootstrap/css/dashboard.css" rel="stylesheet">
    <link href="/asset/artDialog/skins/default.css" rel="stylesheet">
    <link href="/asset/bootstrap/css/bootstrap-datetimepicker.min.css" rel="stylesheet">
    <link href="/asset/bootstrap/build/build_standalone.less" rel="stylesheet">
  </head>

  <body>
    <nav class="navbar navbar-inverse navbar-fixed-top">
      <div class="container-fluid">
        <div class="navbar-header">
          <a class="navbar-brand" href="#">青迅科技</a>
        </div>
      </div>
    </nav>
    <div class="container-fluid">
      <div class="row">
        <div class="col-sm-3 col-md-2 sidebar">
          <ul class="nav nav-sidebar">
            <li class="active"><a href="/user/list">用户列表 <span class="sr-only">(current)</span></a></li>
          </ul>
          <ul class="nav nav-sidebar">
            <li><a href="/user/add">新增用户</a></li>
          </ul>
        </div>
        <div class="col-sm-9 col-sm-offset-1 col-md-10 col-md-offset-2 main">
          <h1 class="page-header">用户管理系统</h1>
          <div id="navbar" class="navbar-collapse collapse">
          	<form action="/user/find" method="post" class="navbar-form navbar-right">
          		<div class="form-group">
            		<input type="text" name="user_name" class="form-control" value="${user_name}" placeholder="请输入用户名">
            	</div>
            	<div class="form-group">
    				<div class="radio-inline">  
        				<input type="radio" name="user_sex" value="1" <c:if test="${user_sex=='1'}">checked</c:if> />  
    					男
    				</div>  
	   	 			<div class="radio-inline">  
	        			<input type="radio" name="user_sex" value="2" <c:if test="${user_sex=='2'}">checked</c:if> />
	        			女  
	    			</div> 
	    			<div class="radio-inline">  
	        			<input type="radio" name="user_sex" value="" <c:if test="${user_sex==''}">checked</c:if> checked="checked" />  
	    				全部
	    			</div>  
  				</div>
          		<div class="form-group">
    				<%-- <input type="text"  name="user_begin"  class="form-control" value="${user_begin}" placeholder="请输入开始添加时间"> --%>
    				<div id="datetimepicker" class="form-group">  
      					<input type="text" name="user_begin" value="${user_begin}"  placeholder="请选择开始时间" readonly class="form_datetime form-control">
        			</div>
    				——
    				<div id="datetimepicker" class="form-group">  
      					<input type="text" name="user_end" value="${user_end}"  placeholder="请选择结束时间" readonly class="form_datetime form-control">
        			</div>
    				<%-- <input type="text"  name="user_end"  class="form-control" value="${user_end}" placeholder="请输入结束添加时间"> --%>
  				</div> 
  				<button type="submit" class="btn btn-default ">查 询</button> 
          	</form>
        </div>
          <div class="table-responsive">
            <table class="table table-striped">
              <thead>
               	<tr>  
   			 		<th style="text-align: center">用户</th>
        			<th style="text-align: center">性别</th> 
        			<th style="text-align: center">年龄</th> 
        			<th style="text-align: center">用户描述</th>
        			<th style="text-align: center">用户添加时间</th>
        			<th style="text-align: center">操作</th>  
   			 	</tr>  
              </thead>
              <tbody style="text-align: center">  
    			<c:forEach items="${users}" var="user">  
    				<tr>  
        				<td>${user.username}</td> 
        				<td>
        					<c:if test="${user.sex=='2'}">女</c:if>
        					<c:if test="${user.sex=='1'}">男</c:if>
        				</td> 
        				<td>${user.age}</td>
        				<td>${user.remark}</td> 
        				<td>${user.time}</td>   
        				<td>
        					<a class="btn btn-primary btn-sm" href="/user/editSubmit/${user.id}">修改</a>  
        					<a id="btn_delete"  name="/user/del/${user.id}" class="btn btn-danger btn-sm" >删除</a>
        				</td>  
    				</tr>  
    			</c:forEach>  
    		</tbody>     
            </table>
            <div>
            	共有<input type="text"  name="user_size" style="width: 5%;" value="${user_size}" disabled="disabled"/>条数据
            </div>
          </div>
        </div>
      </div>
    </div>
    <script src="/asset/bootstrap/js/jquery-1.10.2.min.js"></script>
    <script src="/asset/bootstrap/js/bootstrap.min.js"></script>
    <script src="/asset/bootstrap/js/vendor/holder.min.js"></script>
    <script src="/asset/artDialog/artDialog.js"></script>
    <script src="/asset/bootstrap/js/bootstrap-datetimepicker.min.js"></script>
    <script type="text/javascript">
    	$(document).ready(function(){
    		$(".form_datetime").datetimepicker({
    			minView: "month", //选择日期后，不会再跳转去选择时分秒 
       		    language:  'zh-CN',
       		    format: 'yyyy-mm-dd',
       		    todayBtn:  1,
       		    autoclose: 1,
    		});
    		$("#btn_delete").click(function(){
		    	var url =  $(this).attr("name");
    			art.dialog({
    			    content: '你确定要删除这条信息吗？',
    			    ok: function () {
    			    	this.title('1秒后自动关闭').time(1);
    			    	$.post(url);
    			    	window.location.reload();
    			        return false;
    			    },
    			    cancelVal: '关闭',
    			    cancel: true //为true等价于function(){}
    			});
    		});
    	});
    </script>
  </body>
</html>
